const app = getApp()
import {
  ajaxGetUserPointsRecordOrPetCard
} from '../../../api/my'

Page({
  data: {
    //自定义导航高度
    customNavHeight: app.globalData.customNavInfo.navHeight,
    baseURL: app.globalData.config.baseURL,
    points: 0, // 剩余点数
    pointsList:[],// 消费记录
    
  },
  onLoad(options) {
    const { points, k1UserId } = options
    ajaxGetUserPointsRecordOrPetCard({
      k1UserId,
      recordType: 1,
    }).then(res=>{
      const pointsList = (res.data||[]).map(item=>{
        item.points = (item.type===1?'-':'+')+item.points
        return item
      })
      this.setData({
        points,
        pointsList: pointsList||[]
      })
    })
  },
  onReady() {

  },
  onShow() {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },
})